<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>首页</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../../../css/mui.min.css" rel="stylesheet" />
    <link href="../css/common.css" rel="stylesheet" />
	<link rel="stylesheet" href="../../sitOperation/static/css/common.css" />	
	<link rel="stylesheet" href="../../sitOperation/static/css/terminalwork.css" />
    <style>
      /*九宫格样式*/
      *{ touch-action: pan-y; }
      .home_icon {
      	width: 100%;
      }
      
      .mui-content .mui-icon {
      	width: 100%;
      	padding: 0 26%;
      }
      
      .mui-grid-view.mui-grid-9 {
      	background: #fff;
      	padding: 10px 0;
      }
      
      .mui-grid-view.mui-grid-9 .mui-table-view-cell {
      	border: none;
      	padding: 5px 15px;
      }
      /*图标样式*/
      
      #lineChart {
      	width: 100%;
      	height: 340px;
      	background: #fff;
      	padding: 16px 15px;
      	margin-top: 10px;
      }
      /*弹出框*/
      
      .mui-popover-add {
      	top: 180px!important;
      	width: 80%;
      	margin-left: 10%;
      	background: #ffffff;
      	padding-top: 10px;
        /* z-index: 9999; */
      }
      
      .sp-title {
      	color: #333;
      	width: 100%;
      	text-align: center;
      	padding: 10px 0px;
      	border-bottom: 1px solid #ededed;
      }
      
      .sp-group {
      	width: 92%;
      	margin-left: 4%;
      	display: flex;
      	/*border: 1px solid #0077dc;*/
      	height: 43px;
      	border-radius: 5px;
      	align-items: center;
      	margin-top: 25px;
      }
      .sp-group label{
      	font-size: 0.83rem;
      }
      
      .sp-group input {
      	background: #f3f3f3;
      	border: 1px solid #ededed;
      }
      
      .sp-submit {
      	margin-top: 20px;
      	height: 46px;
      	width: 100%;
      	border-top: 1px solid #C1C1C1;
      	display: flex;
      }
      
      .sp-submit div:first-child {
      	border-right: 1px solid #CCCCCC;
      }
      
      .sp-submit div {
      	width: 50%;
      	text-align: center;
      	line-height: 46px;
      	font-size: 15px;
      }
      
      .sp-submit div:nth-child(2) {
      	color: #0077dc;
      }
      .popCotent{
        padding: 15px;
      }
      .popCotent p{
        text-align: center;
        color: #FF0000;
      }
      .mui-input-row{
        border:1px solid #efefef;
        border-radius: 6px;
      }
      .mui-input-group:before,.mui-input-group:after{
        height: 0;
      }
      .mui-input-group .mui-input-row:after{
        height: 0;
      }
	  .explain-dialog .home_icon {
			width: 50%;
			border-radius: 5px; 
		}
    </style>
  </head>
  <body>
	  <div id="page">
    <div id="container">
      <!--
      <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title">外来人员管理</h1>
      </header>
	  -->
      <div class="mui-content">
        <div id="slider" class="mui-slider">
          <div class="mui-slider-group mui-slider-loop">
            <!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
            <div class="mui-slider-item mui-slider-item-duplicate">
              <a href="#">
                <img src="../img/img.png">
              </a>
            </div>
            <!-- 第一张 -->
            <!-- <div class="mui-slider-item">
                <a href="#">
                  <img src="../img/img.png">
                </a>
              </div> -->
            <!-- 第二张 -->
            <!-- <div class="mui-slider-item">
                <a href="#">
                  <img src="../img/img.png">
                </a>
              </div> -->
            <!-- 第三张 -->
            <!-- <div class="mui-slider-item">
                <a href="#">
                  <img src="../img/img.png">
                </a>
              </div> -->
            <!-- 第四张 -->
            <!-- <div class="mui-slider-item">
                <a href="#">
                  <img src="../img/img.png">
                </a>
              </div> -->
            <!-- 额外增加的一个节点(循环轮播：最后一个节点是第一张轮播) -->
            <!-- <div class="mui-slider-item mui-slider-item-duplicate">
                <a href="#">
                  <img src="../img/img.png">
                </a>
              </div> -->
          </div>
          <div class="mui-slider-indicator">
            <div class="mui-indicator mui-active"></div>
            <!--
              <div class="mui-indicator"></div>
              <div class="mui-indicator"></div>
              <div class="mui-indicator"></div>
			  -->
          </div>
        </div>
        <ul class="mui-table-view mui-grid-view mui-grid-9">
          <!-- <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" @click.stop="page1('zwbh')">
            <a href="javascript:;">
              <span class="mui-icon ">
                <img src="../img/record.png" class="home_icon" />
              </span>
              <div class="mui-media-body">早晚班会</div>
            </a>
          </li>
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" @click.stop="page1('yxrz')">
		    <a href="javascript:;">
		      <span class="mui-icon ">
		        <img src="../img/safe.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">运行日志</div>
		    </a>
		  </li>
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" @click.stop="page1('lp')">
		    <a href="javascript:;">
		      <span class="mui-icon ">
		        <img src="../img/group_home_1.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">两票</div>
            </a>
          </li>
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" @click.stop="page2()">
		    <a href="javascript:;">
		      <span class="mui-icon ">
		        <img src="../img/n2.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">班会签到</div>
		    </a>
		  </li> -->
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" @click.stop="page22()">
		    <a href="javascript:;">
		      <span class="mui-icon ">
		        <img src="../img/dzkp.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">移动两票</div>
		    </a>
		  </li>
          <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" @click.stop="page5">
            <a href="javascript:;">
              <span class="mui-icon ">
                <img src="../img/group_home_2.png" class="home_icon" />

              </span>
              <div class="mui-media-body">巡回检查</div>
            </a>
          </li>
          <!-- <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" id="exam">
            <a href="javascript:;">
              <span class="mui-icon ">
                <img src="../img/group_home_3.png" class="home_icon" />
              </span>
              <div class="mui-media-body">定检风机</div>
            </a>
          </li> -->
          <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" @click.stop="page3">
            <a href="javascript:;">
              <span class="mui-icon ">
                <img src="../img/group_home_4.png" class="home_icon" />

              </span>
              <div class="mui-media-body">一机一档</div>
            </a>
          </li>
          <!-- <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" id="safe">
            <a href="javascript:;">
              <span class="mui-icon ">
                <img src="../img/group_home_5.png" class="home_icon" />

              </span>
              <div class="mui-media-body">运行日志</div>
            </a>
          </li> -->
          <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" id="record">
            <a href="javascript:;">
              <span class="mui-icon ">
                <img src="../img/group_home_6.png" class="home_icon" />

              </span>
              <div class="mui-media-body">外来人员</div>
            </a>
          </li>
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" id="record">
		    <a href="../../mqms/login.html?source=in">
		      <span class="mui-icon ">
		        <img src="../img/group_home_7.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">检修质量</div>
		    </a>
		  </li>
		  <!--style="display:none"-->
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4 sit-operation" 
		  id="sitOperation" v-if="isShowSit" @click="navTo('../../sitOperation/index.html')">
		    <a href="javascript:;">
		      <span class="mui-icon ">
		        <img src="../../sitOperation/static/images/group-home-sit.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">现场运维</div>
		    </a>
		  </li>
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4 control-btn"
		  id="control" v-if="isShowControl" @click="navTo('../../sitOperation/control/index.html')"> 
		    <a href="javascript:;">
		      <span class="mui-icon ">
		        <img src="../../sitOperation/static/images/group-home-jk.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">集控运行</div> 
		    </a>
		  </li>
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4 sit-operation"
		  id="technology" v-if="isShowSit" @click="navTo('../../sitOperation/technology/index.html')">
		    <a href="javascript:;">
		      <span class="mui-icon ">
		        <img src="../../sitOperation/static/images/group-home-js.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">技术管理</div> 
		    </a>
		  </li>
		  
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('01') > -1" @click="navTo('../../sitOperation/dailyRecord/shiftsChange/index.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home01.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">交接班</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('02') > -1" @click="navTo('../../sitOperation/dailyRecord/keyBorrow/index.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home02.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">钥匙借用</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('03') > -1" @click="navTo('../../sitOperation/dailyRecord/transformer/index.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home03.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">变压器有载调压</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('04') > -1" @click="navTo('../../sitOperation/dailyRecord/platenProtect/index.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home05.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">保护压板投退</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('05') > -1" @click="navTo('../../sitOperation/dailyRecord/network/index.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home04.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">涉网设备投退</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('06') > -1" @click="navTo('../../sitOperation/terminalwork/toolCheck/toolCheckList.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home06.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">工器具</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('07') > -1" @click="navTo('')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home11.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">故障管理</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('08') > -1" @click="navTo('../../sitOperation/control/windpowerRecord/windpowerRecord.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home07.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">风电场停机记录</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('09') > -1" @click="navTo('../../sitOperation/control/photFarmRecord/photFarmRecord.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home08.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">光伏电场停机记录</div> 
		     </a>
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('10') > -1" @click="navTo('../../sitOperation/control/dailyReaport/dailyReaport.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home09.png" class="home_icon" /> 
		       </span>
		       <div class="mui-media-body">日报</div> 
		     </a> 
		   </li>
		   <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		   v-if="menuInfo.userSelectMenu.indexOf('11') > -1" @click="navTo('../../sitOperation/control/monthlyReport/monthlyReport.html')">
		     <a href="javascript:;">
		       <span class="mui-icon ">
		         <img src="../../sitOperation/static/images/sit-home10.png" class="home_icon" />
		       </span>
		       <div class="mui-media-body">月报</div>  
		     </a>
		   </li>
		 
		  
		  <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"
		  id="add" @click="showMenuChoose" v-if="isShowControl || isShowSit">
		    <a href="javascript:;">
		      <span class="mui-icon ">
		        <img src="../../sitOperation/static/images/add.png" class="home_icon" />
		      </span>
		      <div class="mui-media-body">菜单管理</div> 
		    </a>
		  </li>
        </ul>
      </div>
      <div id="topPopover1" class="mui-popover mui-popover-add" data-type="">
        <div class="popCotent">
          <p>请输入ERP深化应用密码</p>
          <form class="mui-input-group">
			<div class="mui-input-row" style="margin-bottom:10px">
				<input type="text" class="mui-input-clear" v-model="username" placeholder="请输入员工号">
			</div>
			
            <div class="mui-input-row">
              <input type="password" class="mui-input-password" v-model="password" placeholder="请输入密码" adjust-position="false">

            </div>
          </form>
        </div>
        <div class="sp-submit">
          <div class="sp-submit-quit1" @click="hideTblLogin" id="cancle">
            取消
          </div>
          <div class="sp-submit-sure1" @click="submit">
            确定
          </div>
        </div>
      </div>
	  
	  
	   <!-- 菜单管理弹框 -->
<!-- 		<div v-html="dialogA" v-if="isShowMenuChoose">
			
		</div> -->
	  	  <div :class="[flag?'explain-dialog':'']" v-if="isShowMenuChoose">
	  	   	<div :class="[flag?'explain-in':'']">
	  	   		<div :class="[flag?'explain-header':'']">菜单管理</div>
	  	   		<!-- <div class="explain-con">
	  	   			
	  	   		</div> -->
	  			<ul class="mui-table-view mui-grid-view mui-grid-9" style="border-top: none;">
	  				<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" id="project" 
	  				v-for="(item,index) in menuList" :key="index" @click="chooseMenuItem(index)">  
	  				  <a>
	  					<span class="mui-icon">
	  					  <img :src="item.icon" class="home_icon"/>
	  					  <img src="../../sitOperation/static/images/menu-choose.png" 
	  					  style="position:absolute;right:0;bottom:0;width:22px;height:22px;"
	  					  v-if="item.choose"/>
	  					</span>
	  					<div class="mui-media-body">{{item.name}}</div>
	  				  </a>
	  				</li>
	  			</ul>
	  	   		<div style="display:flex">
	  	   			<div class="explain-btn explain-btn-main" style="width:50%" @click="chooseMenuSure()">确定</div>
	  	   			<div class="explain-btn" style="width:50%" @click="chooseMenuCancel()">取消</div>
	  	   		</div>
	  	   	</div>
	  	   </div>
	  </div>
	  </div>
	  
	  
  </body>

  <script src="../../../js/mui.min.js"></script>
  <script src="../../../js/jquery-1.7.2.min.js"></script>
  <script src="../../../js/vue.js"></script>
  <script src="../js/mkeyplus.base.js"></script>
  <script src="../formal/js/api.js"></script>
  <script src="./js/base64.js"></script>
  <script src="./js/xxtea.js"></script>
  <script src="./js/shoyu-xxtea.js"></script>
  <script type="text/javascript" src="../../sitOperation/static/js/neiosRequst.js"></script>
  <script type="text/javascript" src="../../sitOperation/static/js/neiosCommon.js"></script>
  
  <!-- 其他项目4A登录 -->
  <script src="./js/internalApp4Alogin.js"></script>
  
  <script type="text/javascript" charset="utf-8">
    var htapi = new HTGlobal();
    var floatw = null;
    mui.init({
      swipeBack: true //启用右滑关闭功能
    });
	var page = new Vue({
      el: '#page',
      data: {
		  // dialogA:'<div class="explain-dialog" v-if="isShowMenuChoose"><div class="explain-in"><div class="explain-header">菜单管理</div><ul class="mui-table-view mui-grid-view mui-grid-9" style="border-top: none;"><li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" id="project" v-for="item in menuList" :key="index" v-on:click="chooseMenuItem(index)">  <a><span class="mui-icon"><img :src="item.icon" class="home_icon"/><img src="../../sitOperation/static/images/menu-choose.png" style="position:absolute;right:0;bottom:0;width:22px;height:22px;"v-if="item.choose"/></span><div class="mui-media-body">{{item.name}}</div></a></li></ul><div style="display:flex"><div class="explain-btn explain-btn-main" style="width:50%" v-on:click"chooseMenuSure()">确定</div><div class="explain-btn" style="width:50%" v-on:click="chooseMenuCancel()">取消</div></div></div></div>',
		  
		// dialogClass1:{width: 50%,border-radius: 5px},
		// dialogClass2:{position:absolute,width:90vw,left:5vw,top:10vh,background:#fff,border-radius:2vw},
		isShowMenuChoose:false,
		flag:true,
		username:'',
        password: '',
		loginType:2,//测试2,正式1
		loginCount:0,
		isShowSitIn:false,
		isShowSit:false,
		isShowControl:false, 
		userInfo:'',
		curtype:3,
		menuList:[
			{name:'交接班',icon:'../../sitOperation/static/images/sit-home01.png',choose:false,code:'01'},
			{name:'钥匙借用',icon:'../../sitOperation/static/images/sit-home02.png',choose:false,code:'02'},
			{name:'变压器有载调压',icon:'../../sitOperation/static/images/sit-home03.png',choose:false,code:'03'},
			{name:'保护压板投退',icon:'../../sitOperation/static/images/sit-home05.png',choose:false,code:'04'},
			{name:'涉网设备投退',icon:'../../sitOperation/static/images/sit-home04.png',choose:false,code:'05'},
			{name:'工器具',icon:'../../sitOperation/static/images/sit-home06.png',choose:false,code:'06'},
			{name:'故障管理',icon:'../../sitOperation/static/images/sit-home11.png',choose:false,code:'07'},
			{name:'风电场停机记录',icon:'../../sitOperation/static/images/sit-home07.png',choose:false,code:'08'},
			{name:'光伏电场停机记录',icon:'../../sitOperation/static/images/sit-home08.png',choose:false,code:'09'},
			{name:'日报',icon:'../../sitOperation/static/images/sit-home09.png',choose:false,code:'10'},
			{name:'月报',icon:'../../sitOperation/static/images/sit-home10.png',choose:false,code:'11'}
		],
		menuEditFl:'edit', // 菜单修改状态  新增是add
		menuInfo:{
			userSelectMenu:''
		}, // 已保存的菜单 
		chooseMenuList:'', // 修改的菜单
      },
	  mounted() {
		  let userInfo = JSON.parse(localStorage.getItem('neiosUser'))
		  this.userInfo = JSON.parse(localStorage.getItem('neiosUser'))
		  console.log("当前版本号",localStorage.getItem("currVersion"))
		  console.log("数据人员信息:"+JSON.stringify(userInfo))
		  console.log("ZZZZQQQQ:"+userInfo.roles.indexOf('NEIOS_STATION') > -1 && userInfo.roles.indexOf('NEIOS_CONTROL_EDIT') > -1)
		  if (userInfo.roles.indexOf('NEIOS_STATION') == -1 &&
		  userInfo.roles.indexOf('NEIOS_AREA_COMPANY') == -1 &&
		  userInfo.roles.indexOf('NEIOS_HEAD') == -1) { // 如果当前登陆人不是场站人员、不是分公司人员、不是总部人员
			this.isShowSit = false
			$('#sitOperation').hide()
			$('#technology').hide()
		  } else {
			this.isShowSit = true
		  }
		  if (userInfo.roles.indexOf('NEIOS_AREA_COMPANY') > -1 || userInfo.roles.indexOf('NEIOS_CONTROL_EDIT') > -1) { // 是否有集控权限
			this.isShowControl = true
		  } else if(userInfo.roles.indexOf('NEIOS_STATION') > -1 || userInfo.roles.indexOf('NEIOS_CONTROL_EDIT') > -1) { // 是否有集控权限
			this.isShowControl = true
		  } else if(userInfo.roles.indexOf('NEIOS_HEAD') > -1){
			  this.isShowControl = true
		  }else{
			this.isShowControl = false
			//===角色判断任务修改===
			// $('#sitOperation').show()
			// $('#technology').show()
			//===角色判断任务修改===
		  }
		  //进行最高角色判断 如果有多个角色 按照最高角色进行判断
		  if(userInfo.roles.indexOf('NEIOS_STATION') > -1 || userInfo.roles.indexOf('NEIOS_HEAD') > -1 || userInfo.roles.indexOf('NEIOS_AREA_COMPANY') > -1){
			  if (userInfo.roles.indexOf('NEIOS_STATION') > -1 && userInfo.roles.indexOf('NEIOS_HEAD') == -1 && userInfo.roles.indexOf('NEIOS_AREA_COMPANY') == -1){
				 this.menuList = [
					{name:'交接班',icon:'../../sitOperation/static/images/sit-home01.png',choose:false,code:'01'},
					{name:'钥匙借用',icon:'../../sitOperation/static/images/sit-home02.png',choose:false,code:'02'},
					{name:'变压器有载调压',icon:'../../sitOperation/static/images/sit-home03.png',choose:false,code:'03'},
					{name:'保护压板投退',icon:'../../sitOperation/static/images/sit-home05.png',choose:false,code:'04'},
					{name:'涉网设备投退',icon:'../../sitOperation/static/images/sit-home04.png',choose:false,code:'05'},
					{name:'工器具',icon:'../../sitOperation/static/images/sit-home06.png',choose:false,code:'06'},
					{name:'故障管理',icon:'../../sitOperation/static/images/sit-home11.png',choose:false,code:'07'},
					{name:'风电场停机记录',icon:'../../sitOperation/static/images/sit-home07.png',choose:false,code:'08'},
					{name:'光伏电场停机记录',icon:'../../sitOperation/static/images/sit-home08.png',choose:false,code:'09'},
					{name:'日报',icon:'../../sitOperation/static/images/sit-home09.png',choose:false,code:'10'},
					{name:'月报',icon:'../../sitOperation/static/images/sit-home10.png',choose:false,code:'11'},
				 ]
			  }else{
				  this.menuList = [
					{name:'故障管理',icon:'../../sitOperation/static/images/sit-home11.png',choose:false,code:'07'},
					{name:'风电场停机记录',icon:'../../sitOperation/static/images/sit-home07.png',choose:false,code:'08'},
					{name:'光伏电场停机记录',icon:'../../sitOperation/static/images/sit-home08.png',choose:false,code:'09'},
					{name:'日报',icon:'../../sitOperation/static/images/sit-home09.png',choose:false,code:'10'},
					{name:'月报',icon:'../../sitOperation/static/images/sit-home10.png',choose:false,code:'11'},
				  ]
			  }
		  }else{
			  this.menuList = []
		  }
		  
		  // if (!this.isShowSit && this.isShowControl) {
			 //  this.menuList = [
			 //  	{name:'风电场停机记录',icon:'../../sitOperation/static/images/sit-home07.png',choose:false,code:'08'},
			 //  	{name:'光伏电场停机记录',icon:'../../sitOperation/static/images/sit-home08.png',choose:false,code:'09'},
			 //  	{name:'日报',icon:'../../sitOperation/static/images/sit-home09.png',choose:false,code:'10'},
			 //  	{name:'月报',icon:'../../sitOperation/static/images/sit-home10.png',choose:false,code:'11'}
			 //  ]
		  // } else if (this.isShowSit && !this.isShowControl) {
			 //  this.menuList = [
			 //  	{name:'交接班',icon:'../../sitOperation/static/images/sit-home01.png',choose:false,code:'01'},
			 //  	{name:'钥匙借用',icon:'../../sitOperation/static/images/sit-home02.png',choose:false,code:'02'},
			 //  	{name:'变压器有载调压',icon:'../../sitOperation/static/images/sit-home03.png',choose:false,code:'03'},
			 //  	{name:'保护压板投退',icon:'../../sitOperation/static/images/sit-home05.png',choose:false,code:'04'},
			 //  	{name:'涉网设备投退',icon:'../../sitOperation/static/images/sit-home04.png',choose:false,code:'05'},
			 //  	{name:'工器具',icon:'../../sitOperation/static/images/sit-home06.png',choose:false,code:'06'},
			 //  	{name:'故障管理',icon:'../../sitOperation/static/images/sit-home11.png',choose:false,code:'07'}
			 //  ]
		  // }
		  //===角色判断任务修改===
		  // 获取当前人员menu
		  this.queryMenu()
	  },
      methods:{
		  page1(type){
			  // mui.toast('待4A上线开放！');return;
			  console.log('curtype=='+this.curtype);
			  if(this.curtype == 1){
				  mui.toast('当前无网络！');return;
			  }
			  var C = G_Config();
			  urlz = C.protocol+C.host+C.LP_path
			  child4Alogin.tourbillon(urlz,type)
			 
		  },
		  page2(){
			  if(this.curtype == 1){
			  	mui.toast('当前无网络！');return;
			  }
			  var C = G_Config();
			  urlz = C.protocol+C.host+C.LP_path
			  child4Alogin.signIn(urlz)
		  },
		  page22(){
			  mui.openWindow({
				  url: 'index-child.html',
				  id: '../iankong.html',
				  extras: {}
			  });
		  },
		  page3(){
			  /** 一机一档页面
			   * @method page3
			   * @param {空}
			   * @return {空}
			  */
			 //mui.toast('功能正在完善中，敬请期待！');return;
			 if(this.curtype == 1){
			 	 mui.toast('当前无网络！');return;
			 }
			 var C = G_Config();
			 child4Alogin.ddms(C.protocol+C.host+C.YJYD_path);
			 return;
		  },
		  page5(){
			  /** 巡回检查
			   * @method page5
			   * @param {空}
			   * @return {空}
			  */
			 if(this.curtype == 1){
				 var btnArray = ['取消', '确定'];
				 mui.confirm('当前无网络，是否离线登录？', '提示', btnArray, function(e) {
				   if (e.index == 1) { 
				    console.log('离线登录');
					 mui.openWindow({
						  url: '../../jiankong/jiankong.html',
						  id: '../jiankong/jiankong.html',
						  extras: {}
					 });
				   }
				 })
			 }else{
				var C = G_Config();
				child4Alogin.jiankong(C.protocol+C.host+C.XJ_path); 
			 }
		  },
		  submit(){
			  //登录
		  },
		  tblLogin(params){
			/** 提交登录
			 * @method tblLogin
			 * @param {params} 登录完成后的参数
			 * @return {空}
			*/  
		   if(this.password==''){
		     mui.toast('请输入密码');
		   		return;
		   }
		   
		   var userName = this.username;
		   
		   var password = this.password;
		   //保存用户信息
		   var cvs = {
		         url: params.url,
		         id: params.id,
		         extras: {
		           username:userName,
		           password:password,
				   topage:params.topage||'',
				   loginType:page.loginType
		         }
		   }
		   
		   if(this.loginCount==0){
			   //第一次登录
			   this.testLogin(()=>{
				   page.loginCount++
				   page.toPage(cvs)
			   })
			   return;
		   }
		  
				page.hideTblLogin()
		        return page.toPage(cvs)
		  
		   /* end tblLogin */
		  },
		  toPage(params){
			/** 跳转到对应页面
			 * @method toPage
			 * @param{params}页面对象参数
			 * @return {空}
			*/
		   params.waiting={
           	autoShow:false
           }
		   mui.openWindow(params);
		  },
		  hideTblLogin(){
			  /** 隐藏深化应用登录
			   * @method hideTblLogin
			   * @param{空}
			   * @return {空}
			  */
			 mui('#topPopover1').popover('hide');
		  },
		  showTblLogin(){
			  /** 显示深化应用登录
			   * @method showTblLogin
			   * @param{空}
			   * @return {空}
			  */
			  var main = plus.webview.currentWebview().opener();
			  mui.fire(main,'popUp');
			  mui('#topPopover1').popover('show');
		  },
		  checkTblLogin(){
			  /** 检测是否登录深化应用
			   * @method checkTblLogin
			   * @param{空}
			   * @return {空}
			  */
			 var T = this
			 if(T.username && T.password){
				 //已存在用户名密码
				 return true
			 }else{
				 //未有用户名密码-弹出登录框
				 var _user = localStorage.getItem('groupUser');
				 //console.log(plus.webview.currentWebview().id)
				 page.showTblLogin()
				 //mui.trigger(document.querySelector('.sp-submit-sure1'),'tap');
				 console.log(_user)
				 _user=JSON.parse(_user)
				 page.username =_user.userName
				 
				 return false
			 }
		  },
		  testLogin(callback){
			 /** 初测试登录
			  * @method testLogin
			  * @param{空}
			  * @return {空}
			 */ 
         plus.nativeUI.showWaiting('登录中...');
          var userName = page.username;
          var password = page.password;
          var SHYY_url = mui.baseWApp.serverUrl+'/../smartreport-api/sso/login?platform=A&loginType='+page.loginType;
       
           mui.ajax({
             url: SHYY_url,
             headers: {
                 'Authorization': 'Basic '+ Base64.encode(userName + ':'+ password) //自定义请求头信息
             },
             timeout: 3000,
             dataType: 'json',
             type: 'post',
             success: function(res) {
               if(res.success){
				   callback()
               }else{
				   page.username = ''
                  mui.toast('登录错误！请核对账户名及密码！');
               }
				page.hideTblLogin()
                plus.nativeUI.closeWaiting()
             }})

		  },
		  // 展示缺菜单管理
		  showMenuChoose () {
			  console.log("点击了菜单管理=========",JSON.stringify(this.menuList))			  
			  this.isShowMenuChoose = true
			  for (let i=0; i < this.menuList.length; i++) {
				  if (this.menuInfo.userSelectMenu.indexOf(this.menuList[i].code) > -1) {
					  this.menuList[i].choose = true
					  this.chooseMenuList = this.menuInfo.userSelectMenu
				  }
			  }
		  },
		  // 获取当前人员menu 
		  queryMenu () { 
			  let _this = this
			  let params = {
			  	userStaffCode: JSON.parse(localStorage.getItem('neiosUser')).userId
			  }
			  console.log("菜单人员========"+JSON.stringify(params)) 
			  mui.neiosRequst.httpRequst('/app/appHomeMenu/queryMenu', params,
			  	function(data) { 
					console.log("菜单返回》》"+JSON.stringify(data))
			  		if (data.code == '0') {  
			  			if (data.data == null || data.data == undefined || data.data.homeMenuId == null) {
							_this.menuEditFl = 'add'
							_this.menuInfo = {
								homeMenuId:mui.neiosCommon.getUuidv4(),//首页菜单主键
								newAreaCode:_this.userInfo.companyCode,//新能源分公司编号
								newStationCode:localStorage.getItem('neiosStationCode'),//新能源场站编号
								userStaffCode:_this.userInfo["userId"],//用户编号
								userStaffName:_this.userInfo["name"],//用户姓名
								userSelectMenu:'',//用户所选菜单,json形式保存
								remark:'',//备注
								client:'NEIOS',//客户ID
								dataSource:'NEIOS_APP',//数据来源
								status:'',//业务状态
								dataStatus:'1',//是否有效 参见码表0删除&1正常
								createBy:_this.userInfo["name"],//创建人员
								createStaffName:_this.userInfo["name"],//创建人姓名
								createDate:'',//创建时间
								modifyBy:'',//修改人员
								modifyStaffName:'',//修改人员姓名
								modifyDate:'',//修改时间
							}
						} else {
							_this.menuInfo = data.data
							//===角色判断任务修改===
							let tempUserSelect = ""
							console.log("=====查出了用户所保存的菜单======",JSON.stringify(_this.menuInfo))							
							//菜单过滤 为了处理历史错误数据 不属于他的菜单给取消掉  场站角色不用过滤 可以看到全部菜单
							if (_this.userInfo.roles.indexOf('NEIOS_STATION') == -1){
								console.log("=======保存的菜单过滤处理开始========",JSON.stringify(_this.menuInfo.userSelectMenu));
								for (let i=0; i < _this.menuList.length; i++) {
									  if (_this.menuInfo.userSelectMenu.indexOf(_this.menuList[i].code) > -1) {
											tempUserSelect += _this.menuList[i].code + ","											
									  }
								}
								 tempUserSelect = tempUserSelect.substring(0, tempUserSelect.lastIndexOf(","));
								_this.menuInfo.userSelectMenu = tempUserSelect	
								console.log("=======保存的菜单过滤结束，过滤完剩下的菜单========",JSON.stringify(_this.menuInfo.userSelectMenu));												}
							//===角色判断任务修改===
							_this.menuEditFl = 'edit'
						}
			  		} else { 
			  			// mui.toast('新增失败，请稍后重试！')
						// $('#add').hide() 
			  		}
			  	},
			  	function() {
			  		// mui.toast('新增失败，请稍后重试！')
					// $('#add').hide()  
			  	}
			  ); 
		  },
			// 点击选择菜单
			chooseMenuItem (index) {
				this.menuList[index].choose = !this.menuList[index].choose
				let list
				console.log(this.chooseMenuList)
				if (this.chooseMenuList == '' || this.chooseMenuList == undefined || this.chooseMenuList == null) {
					list = []
				} else {
					list = this.chooseMenuList.split(',')
				}
				if (this.menuList[index].choose) {
					list.push(this.menuList[index].code)
				} else {
					list.splice(list.findIndex(item => item === this.menuList[index].code), 1)
				}
				this.chooseMenuList = list.toString()
				console.log(this.chooseMenuList)
			},
			// 确定
			chooseMenuSure () {
				let _this = this
				let params = {
					appHomeMenu : JSON.parse(JSON.stringify(_this.menuInfo)),
					type : ''
				}
				params.appHomeMenu.userSelectMenu = this.chooseMenuList
				if (_this.menuEditFl == 'add') {
					params.appHomeMenu.createDate = mui.neiosCommon.transTime(new Date()) 
					params.type = 'add'
				} else {
					params.appHomeMenu.modifyBy = _this.userInfo["userId"]
					params.appHomeMenu.modifyStaffName = _this.userInfo["name"]
					params.appHomeMenu.modifyDate = mui.neiosCommon.transTime(new Date())
					params.type = 'edit'
				}
				console.log(JSON.stringify(params))
				mui.neiosRequst.httpRequst('/app/appHomeMenu/saveOrUpdateMenu', params,
					function(data) {  
						if (data.code == '0') { 
							_this.chooseMenuCancel()
							_this.queryMenu()
							mui.toast('保存成功！')
						} else {  
							mui.toast('保存失败，请稍后重试！')
						}
					},
					function() {
						mui.toast('保存失败，请稍后重试！')
					}
				); 
			},
			// 取消
			chooseMenuCancel () {
				 this.isShowMenuChoose = false
				 //===角色判断任务修改===
				//  this.menuList = [
				// 	{name:'交接班',icon:'../../sitOperation/static/images/sit-home01.png',choose:false,code:'01'},
				// 	{name:'钥匙借用',icon:'../../sitOperation/static/images/sit-home02.png',choose:false,code:'02'},
				// 	{name:'变压器有载调压',icon:'../../sitOperation/static/images/sit-home03.png',choose:false,code:'03'},
				// 	{name:'保护压板投退',icon:'../../sitOperation/static/images/sit-home05.png',choose:false,code:'04'},
				// 	{name:'涉网设备投退',icon:'../../sitOperation/static/images/sit-home04.png',choose:false,code:'05'},
				// 	{name:'工器具',icon:'../../sitOperation/static/images/sit-home06.png',choose:false,code:'06'},
				// 	{name:'故障管理',icon:'../../sitOperation/static/images/sit-home11.png',choose:false,code:'07'},
				// 	{name:'风电场停机记录',icon:'../../sitOperation/static/images/sit-home07.png',choose:false,code:'08'},
				// 	{name:'光伏电场停机记录',icon:'../../sitOperation/static/images/sit-home08.png',choose:false,code:'09'},
				// 	{name:'日报',icon:'../../sitOperation/static/images/sit-home09.png',choose:false,code:'10'},
				// 	{name:'月报',icon:'../../sitOperation/static/images/sit-home10.png',choose:false,code:'11'}
				// ]
				//===角色判断任务修改===
			},
			navTo(e){
				mui.openWindow({
					url: e,
					id: e,
					extras: {},
				waiting: {
				autoShow: false
				}
				});
			}, 
			
      },
    })
    mui.plusReady(function() {})
    $('#record').on('tap', function() {
	  console.log('curtype='+page.curtype);
	  if(page.curtype == 1){
	  	 mui.toast('当前无网络！');return;
	  }
      mui.openWindow({
        url: './personnel_management.html',
        id: './personnel_management.html',
        extras: {},
        waiting: {
          autoShow: false
        }
      })
    });

    $('#notice').on('tap', function() {
      mui.toast('功能正在完善中，敬请期待！');return;
      var user = localStorage.getItem('outUser'),
        openPath = '../formal/registration_on.html';
      //console.log(user);return;
      if (user) {
        user = JSON.parse(user);
        if (user.notice && user.notice != 0) {
          openPath = './admission.html';
        }
      }
      //console.log(openPath);return;	
      mui.openWindow({
        url: openPath,
        id: openPath,
        extras: {},
        waiting: {
          autoShow: false
        }
      })
    });
    $('#safe').on('tap', function() {
      mui.toast('功能正在完善中，敬请期待！');return;
      mui.openWindow({
        url: './safe.html',
        id: './safe.html',
        extras: {},
        waiting: {
          autoShow: false
        }
      })
    });
    $('#edu').on('tap', function() {
      mui.toast('功能正在完善中，敬请期待！');return;
      mui.openWindow({
        url: '../edu/index.html',
        id: '../edu/index.html',
        extras: {},
        waiting: {
          autoShow: false
        }
      })
    });
    $('#exam').on('tap', function() {
      mui.toast('功能正在完善中，敬请期待！');return;
      mui.openWindow({
        url: '../examScore/index.html',
        id: '../examScore/index.html',
        extras: {},
        waiting: {
          autoShow: false
        }
      })
    });
    var first = null; //第一次点击backbutton
    mui.plusReady(function() {
		page.curtype = plus.networkinfo.getCurrentType();
      var new_back = mui.back;
      mui.back = function() {
        //首次按键，提示‘再按一次退出应用’
        if (!first) {
          first = new Date().getTime();
          mui.toast('再按一次退出应用');
          setTimeout(function() {
            first = null;
          }, 800);
        } else {
          if (new Date().getTime() - first < 1000) {
            plus.runtime.quit();
          }
        }
      }
    })
	$('#sitOperation').on('click', function() {
	  mui.openWindow({
	    url: '../../sitOperation/index.html',
	    id: '../../sitOperation/index.html',
	    extras: {},
	    waiting: {
	      autoShow: false
	    }
	  })
	});
	$('#control').on('click', function() {
	  mui.openWindow({
	    url: '../../sitOperation/control/index.html',
	    id: '../../sitOperation/control/index.html',
	    extras: {},
	    waiting: {
	      autoShow: false
	    }
	  })
	});
	$('#technology').on('click', function() {
	  mui.openWindow({
	    url: '../../sitOperation/technology/index.html',
	    id: '../../sitOperation/technology/index.html',
	    extras: {},
	    waiting: {
	      autoShow: false
	    }
	  })
	});
  </script>
</html>
